﻿#ifndef __AVOID_CONTROL_INTERFACE_SMOOTH_TRANSFORM_HEAD_FILE_INCLUDED__
#define __AVOID_CONTROL_INTERFACE_SMOOTH_TRANSFORM_HEAD_FILE_INCLUDED__
#include "../control.h"

namespace swui
{
	class ISmoothTransform : virtual public ctlRoot
	{
	public:
		ISmoothTransform();
	public:
		void enableSmoothTransform(bool);
		bool isSmoothTransformEnabled();
	public:
		//设置变换一次所需的时间
		void setSmoothTransformTime(unsigned millsecond);
		unsigned getSmoothTransformTime();
	public:
		//这决定计时器的间隔，数值越小越平滑，但相同时间需要重绘的次数也越多
		void setSmoothTransformStepTime(unsigned millsecond);
		unsigned getSmoothTransformStepTime();
	protected:
		void _smooth_transform_mouse_event(ctlMouseEvent* me);
	private:
		unsigned _smooth_transform_timer_id;
		bool _smooth_transform_enable;
		unsigned _smooth_transform_time;
		unsigned _smooth_transform_step_time;
	};
	
	inline ISmoothTransform::ISmoothTransform()
		: _smooth_transform_timer_id(0),
		_smooth_transform_enable(false),
		_smooth_transform_time(400),
		_smooth_transform_step_time(50) { }
	inline void ISmoothTransform::enableSmoothTransform(bool enable)
	{
		_smooth_transform_enable = enable;
	}
	inline bool ISmoothTransform::isSmoothTransformEnabled()
	{
		return _smooth_transform_enable;
	}
	inline void ISmoothTransform::setSmoothTransformTime(unsigned millsecond)
	{
		_smooth_transform_time = millsecond;
	}
	inline unsigned ISmoothTransform::getSmoothTransformTime()
	{
		return _smooth_transform_time;
	}
	inline void ISmoothTransform::setSmoothTransformStepTime(unsigned millsecond)
	{
		_smooth_transform_step_time = millsecond;
	}
	inline unsigned ISmoothTransform::getSmoothTransformStepTime()
	{
		return _smooth_transform_step_time;
	}
}

#endif